<?php
/**
 * ClassName: card_preferential
 * Description:
 * @Author 周昌
 * @Create 2023/11/23 14:23
 */

namespace app;


use epii\server\Args;
use model\CardCateModel;
use model\CardPreferentialModel;
use service\admin\CardPreferentialService;

class card_preferential extends base
{
    public function init()
    {
        parent::init();
        $this->accessDenied();
    }
    public function add_edit()
    {
        $card_cate_id = Args::params('card_cate_id');
        if ($_SERVER['REQUEST_METHOD'] == "POST") {
            $r = Args::params('r');
            $r['card_cate_id']=$card_cate_id;
            $r['hospital_id']=CardCateModel::getValue(['id'=>$card_cate_id],'hospital_id');
            $res=CardPreferentialService::delBeforAdd($r);
            $res['code']?$this->success($res['msg']):$this->error($res['msg']);
        }
        $this->_as_info = CardPreferentialModel::getList(['card_cate_id'=>$card_cate_id]);
        $this->_as_card_cate_id = $card_cate_id;

        $this->adminUiDisplay();
    }

}